<?php
class GameToolsAction extends CommonAction{
	
	function insert() {
            //$name=$this->getActionName();
            $model = D ('game_tools');
            
            
            if (false ===$data = $model->create ()) {
			$this->error ( $model->getError () );
		}
                //print_r($data);
                
            $list=$model->add ($data);
            
            
            //exit;
            if ($list!==false) { 
                $this->saveLog(1,$list);
                $this->success (L('ADD_SUCCESS'));
            } else {
			//失败提示
		$this->saveLog(0,$list);
		$this->error (L('ADD_FAILED'));
		}
                
        }
        
        function update() {
           //$name=$this->getActionName();
           /*
            $model = D ('game_tools');
            
            
            if (false ===$data = $model->create ('','edit')) {
			$this->error ( $model->getError () );
		}
                
            $list=$model->save ($data);
            print_r($list);
                
                exit;
            //exit;
            if ($list!==false) { 
                $this->saveLog(1);
		$this->success (L('EDIT_SUCCESS'));
            } else {
			//失败提示
		$this->saveLog(0);
		$this->error (L('EDIT_FAILED'));
		}
           */     
            $model	=	D("game_tools");
		if($model->create()) {
			$list=$model->save();
                        //print_r($list);
                        //exit;
			if($list!==false){
				$this->success (L('EDIT_SUCCESS'));
			}else{
				$this->error (L('EDIT_FAILED'));
			}
		}else{
			$this->error($model->getError());
		}
        }
        
}

?>